#include <stdio.h>
#include <math.h>

#define PI acos(-1)

double hav(double num) {
    return (1.0 - cos(num)) / 2.0;
}

double degreeToRad(double degree) {
    return degree * PI / 180.0;
}

int main() {
    double latitude1, longitude1, latitude2, longitude2;
    scanf("%lf%lf", &latitude1, &longitude1);
    scanf("%lf%lf", &latitude2, &longitude2);
    double havReuslt = hav(degreeToRad(latitude2 - latitude1)) +
        cos(degreeToRad(latitude1)) * cos(degreeToRad(latitude2)) *
        hav(degreeToRad(longitude2 - longitude1));
    double dDivR = acos(1- 2 * havReuslt);
    double radius = 6371.0;
    printf("%.4lfkm", dDivR * radius);
    return 0;
}